package com.bestcem.xm.common.core.sequence.dao;

import com.bestcem.xm.common.core.sequence.entity.SequenceDO;
import com.bestcem.xm.common.core.sequence.entity.SequenceEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * 示例服务
 *
 * @author yf.wang <yf.wang@idiaoyan.com>
 * @version V1.0
 * @date 2021/7/31
 */
public interface SequenceDao {
    /**
     * 根据code 获取序号信息
     *
     * @param code
     * @return
     */
    SequenceDO findOneByCode(String code);

    /**
     * 更新
     *
     * @param sequence
     * @return
     */
    SequenceDO findOneAndUpdateByCode(SequenceEntity sequence);

    /**
     * 更新 seq 为 incrStep
     *
     * @param code
     * @param seq
     * @param incrStep
     */
    void findOneAndUpdateByCodeAndSeq(String code, Integer seq, Integer incrStep);

    /**
     * 根据code 获取序号信息 且 seq + incr
     *
     * @param code
     * @param incr
     */
    void findOneAndUpdateByCodeAndSeqInc(String code, int incr);


    /**
     * 更新seq
     *
     * @param seq
     * @param code
     */
    void updateSeqByCode(Integer seq, String code);

    /**
     * 批量新增seq
     *
     * @param createList
     * @return void
     * @author panyun <yun.pan@idiaoyan.com>
     * @date 2022/7/21 15:02
     */
    void batchCreate(ArrayList<SequenceEntity> createList);

    /**
     * 批量更新seq
     *
     * @param sequenceList
     * @return void
     * @author panyun <yun.pan@idiaoyan.com>
     * @date 2022/7/21 15:02
     */
    void batchUpdateSeq(List<SequenceEntity> sequenceList);

    /**
     * 根据code批量查找
     *
     * @param codes
     * @return java.util.ArrayList<com.bestcem.xm.member.entity.pojo.SequenceDO>
     * @author panyun <yun.pan@idiaoyan.com>
     * @date 2022/8/1 15:08
     */
    ArrayList<SequenceEntity> listByCodes(ArrayList<String> codes);
}
